<?php
if(!isset($GLOBALS['_vars'])) $GLOBALS['_vars'] = array(); 
$fields = array();
?><!doctype html>
<html>
<head>
<meta charset="<?php echo $cfg_soft_lang; ?>">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>消息管理 - 会员中心 - <?php echo $cfg_webname; ?></title>

<link href="/templets/nbbmobi/style/bootstrap.css" rel="stylesheet" type="text/css" />
<link href="templets/style/base.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="templets/js/j.js"></script>
<script type="text/javascript" src="templets/js/load.js"></script>
<script type="text/javascript" src="templets/js/table_function.js"></script>
<script type="text/javascript" src="templets/js/leftmenu.js"></script>
<script type="text/javascript">
//获得选中文件的文件名
function GetCheckfolderItem()
{
	var allSel='';
	if(document.form1.deleteid.value) return document.form1.deleteid.value;
	for(i=0;i<document.form1.deleteid.length;i++)
	{
		if(document.form1.deleteid[i].checked)
		{
			if(allSel=='')
			allSel=document.form1.deleteid[i].value;
			else
			allSel=allSel+","+document.form1.deleteid[i].value;
		}
	}
	return allSel;
}
	
	function DoSubmit(myfolder)
	{
		var selid = GetCheckfolderItem();
		if(selid=='') {
			alert("你没选中任何信息！");
			return false;
		}
		if(window.confirm("你确定要删除这些消息么？"))
		{
			location = "pm.php?dopost=del&ids="+selid+"&folder="+myfolder;
		}
	}
</script>
</head>
<body>
  <?php include(DEDEMEMBER."/templets/head.htm"); ?>
<div class="container-xl">
  <div class="row">

    <div class="col-12 bg-white">
	<div class="my-3"><a href="pm.php?folder=inbox"><span>收件箱</span></a></div>

      <?php
        if($folder == "inbox"){
       ?>
	   <div class="my-3">
		<a class="btn btn-primary btn-sm" href="pm.php?folder=<?php echo $folder;?>"><span>全部</span></a>
		<a class="btn btn-primary btn-sm" href="pm.php?folder=<?php echo $folder;?>&state=1"><span>已阅读</span></a>
		<a class="btn btn-primary btn-sm" href="pm.php?folder=<?php echo $folder;?>&state=-1"><span>未阅读</span></a>
	   </div>
     
     <?php
      }
      ?>
      <div id="mainCp">
        <!--内容消息提示 -->
        <h3 class="meTitle">短消息列表</h3>
        <form action="pm.php" method="post" name="form1">
        <input type='hidden' name='dopost' value='del' />
        <div class="table-responsive">
          <table class="table table-hover">
            <thead class="thead-light">
              <tr>
                <th>&nbsp;</th>
                <th >标题</th>
                <th><?php
          	if($folder == "inbox") echo "发件人";
          	else echo "收件人";
          	?></th>
                <th>状态 </th>
                <th>发布时间 </th>
              </tr>
            </thead>
         <tbody>
            <?php
$atts = array();
$atts['tagname'] = 'datalist';
$blockValue = $this->refObj->GetArcList($atts,$this->refObj,$fields); 
if(is_array($blockValue)){
foreach( $blockValue as $key=>$fields )
{
?>
            <tr>
              <td><input type="checkbox" name="deleteid" value="<?php echo $fields['id']; ?>" style=" margin-left:5px"/></td>
              <td class="tabTitle"><?php
           if($fields['hasview']==0) echo "<a href='pm.php?dopost=read&id={$fields['id']}'>{$fields['subject']}</a>";
           else echo "<a href='pm.php?dopost=read&id={$fields['id']}'>{$fields['subject']}</a>";
           ?></td>
              <td>系统</td>
              <td><?php
          $readmsg = ($fields['hasview']==0 ? "<span style='color:red'>未阅读</span>" : '已阅读');
          echo $readmsg;
          ?>
              </td>
              <td><?php
          echo MyDate('y-m-d H:i:s',$fields['sendtime']);
          ?></td>
            </tr>
            <?php
}
}?>
            </tbody>
          <tfoot>
            <tr>
              <td colspan="6">
              <div class="control fLeft doPost" style="margin-top:10px"><button type="button" onclick="DoSubmit('<?php echo $folder; ?>')" class="greenBtn3">删除选中</button></div>
              <div class="pageList"><?php
$atts = array();
$atts['tagname'] = 'pagelist';
$atts['listsize'] = '5';
 echo $this->refObj->GetPageList($atts,$this->refObj,$fields); 
?>
</div>
              </td>
            </tr>
          </tfoot>
        </table>
        </div>
         </form>
      </div>
      <!--主操作区域 -->
    </div>
  </div>
  </div>
<?php include(DEDEMEMBER."/templets/foot.htm"); ?>

</body>
</html>